home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Science⁄Math / Gnuplot 3.5 for Macintosh / SOURCES 3.5 / term.c < prev    next >
Text File  |  1993-11-12  |  71KB  |  2,343 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: term.c%v 3.50.1.17 1993/08/27 05:21:33 woo Exp woo $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - term.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * There is a mailing list for gnuplot users. Note, however, that the
  35.  * newsgroup 
  36.  *    comp.graphics.gnuplot 
  37.  * is identical to the mailing list (they
  38.  * both carry the same set of messages). We prefer that you read the
  39.  * messages through that newsgroup, to subscribing to the mailing list.
  40.  * (If you can read that newsgroup, and are already on the mailing list,
  41.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  42.  * removed from the mailing list.)
  43.  *
  44.  * The address for mailing to list members is
  45.  *       info-gnuplot@dartmouth.edu
  46.  * and for mailing administrative requests is 
  47.  *       info-gnuplot-request@dartmouth.edu
  48.  * The mailing list for bug reports is 
  49.  *       bug-gnuplot@dartmouth.edu
  50.  * The list of those interested in beta-test versions is
  51.  *       info-gnuplot-beta@dartmouth.edu
  52.  */
  53.  
  54. #include <stdio.h>
  55. #include <ctype.h>
  56. #include "plot.h"
  57. #ifdef THINK_C
  58. #include "tout_protos.h"
  59. #endif
  60.  
  61. #include "setshow.h"
  62. #include "term.h"
  63. #include "bitmap.h"
  64. #ifdef NEXT
  65. #include <stdlib.h>
  66. #include "epsviewe.h"
  67. #endif /* NEXT */
  68.  
  69. #ifdef _Windows
  70. #ifdef __MSC__
  71. #include <malloc.h>
  72. #else
  73. #include <alloc.h>
  74. #endif
  75. #endif
  76.  
  77. #if defined(__TURBOC__) && defined(MSDOS)
  78. #ifndef _Windows
  79. #include <dos.h>
  80. #endif
  81. #endif
  82.  
  83. /* for use by all drivers */
  84. #define sign(x) ((x) >= 0 ? 1 : -1)
  85. #define abs(x) ((x) >= 0 ? (x) : -(x))
  86.  
  87. #ifndef max    /* GCC uses inline functions */
  88. #define max(a,b) ((a) > (b) ? (a) : (b))
  89. #endif
  90. #ifndef min
  91. #define min(a,b) ((a) < (b) ? (a) : (b))
  92. #endif
  93.  
  94. TBOOLEAN term_init;            /* true if terminal has been initialized */
  95.  
  96. extern FILE *outfile;
  97. extern char outstr[];
  98. extern TBOOLEAN term_init;
  99. extern int term;
  100. extern float xsize, ysize;
  101.  
  102. extern char input_line[];
  103. extern struct lexical_unit token[];
  104. extern int num_tokens, c_token;
  105. extern struct value *const_express();
  106.  
  107. extern TBOOLEAN interactive;
  108.  
  109. /*
  110.  * instead of <strings.h>
  111.  */
  112.  
  113. #if defined(_Windows) || ( defined(__TURBOC__) && defined(MSDOS) ) || defined(THINK_C)
  114. # include <string.h>
  115. #else
  116. #ifdef ATARI
  117. #include <string.h>
  118. #include <math.h>
  119. #else
  120. #ifndef AMIGA_SC_6_1
  121. extern char *strcpy();
  122. #ifdef ANSI
  123. extern size_t   strlen();
  124. #else
  125. extern int      strlen();
  126. #endif
  127. extern int  strcmp(), strncmp();
  128. #endif /* !AMIGA_SC_6_1 */
  129. #endif
  130. #endif
  131.  
  132. #ifndef AMIGA_AC_5
  133. extern double sqrt();
  134. #endif
  135.  
  136. char *getenv();
  137.  
  138. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  139. char *turboc_init();
  140. #endif
  141.  
  142. #ifdef __ZTC__
  143. char *ztc_init();
  144. /* #undef TGIF */
  145. #endif
  146.  
  147.  
  148. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  149. void reopen_binary();
  150. #define REOPEN_BINARY
  151. #endif
  152. #ifdef vms
  153. char *vms_init();
  154. void vms_reset();
  155. void term_mode_tek();
  156. void term_mode_native();
  157. void term_pasthru();
  158. void term_nopasthru();
  159. void reopen_binary();
  160. void fflush_binary();
  161. #define REOPEN_BINARY
  162. #endif
  163.  
  164. /* This is needed because the unixplot library only writes to stdout. */
  165. #ifdef UNIXPLOT
  166. FILE save_stdout;
  167. #endif
  168. int unixplot=0;
  169.  
  170. #define NICE_LINE        0
  171. #define POINT_TYPES        6
  172.  
  173.  
  174. do_point(x,y,number)
  175. int x,y;
  176. int number;
  177. {
  178. register int htic,vtic;
  179. register struct termentry *t = &term_tbl[term];
  180.  
  181.      if (number < 0) {        /* do dot */
  182.         (*t->move)(x,y);
  183.         (*t->vector)(x,y);
  184.         return(0);
  185.     }
  186.  
  187.     number %= POINT_TYPES;
  188.     htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  189.     vtic = (t->v_tic/2);    
  190.  
  191.     switch(number) {
  192.         case 0: /* do diamond */ 
  193.                 (*t->move)(x-htic,y);
  194.                 (*t->vector)(x,y-vtic);
  195.                 (*t->vector)(x+htic,y);
  196.                 (*t->vector)(x,y+vtic);
  197.                 (*t->vector)(x-htic,y);
  198.                 (*t->move)(x,y);
  199.                 (*t->vector)(x,y);
  200.                 break;
  201.         case 1: /* do plus */ 
  202.                 (*t->move)(x-htic,y);
  203.                 (*t->vector)(x-htic,y);
  204.                 (*t->vector)(x+htic,y);
  205.                 (*t->move)(x,y-vtic);
  206.                 (*t->vector)(x,y-vtic);
  207.                 (*t->vector)(x,y+vtic);
  208.                 break;
  209.         case 2: /* do box */ 
  210.                 (*t->move)(x-htic,y-vtic);
  211.                 (*t->vector)(x-htic,y-vtic);
  212.                 (*t->vector)(x+htic,y-vtic);
  213.                 (*t->vector)(x+htic,y+vtic);
  214.                 (*t->vector)(x-htic,y+vtic);
  215.                 (*t->vector)(x-htic,y-vtic);
  216.                 (*t->move)(x,y);
  217.                 (*t->vector)(x,y);
  218.                 break;
  219.         case 3: /* do X */ 
  220.                 (*t->move)(x-htic,y-vtic);
  221.                 (*t->vector)(x-htic,y-vtic);
  222.                 (*t->vector)(x+htic,y+vtic);
  223.                 (*t->move)(x-htic,y+vtic);
  224.                 (*t->vector)(x-htic,y+vtic);
  225.                 (*t->vector)(x+htic,y-vtic);
  226.                 break;
  227.         case 4: /* do triangle */ 
  228.                 (*t->move)(x,y+(4*vtic/3));
  229.                 (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  230.                 (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  231.                 (*t->vector)(x,y+(4*vtic/3));
  232.                 (*t->move)(x,y);
  233.                 (*t->vector)(x,y);
  234.                 break;
  235.         case 5: /* do star */ 
  236.                 (*t->move)(x-htic,y);
  237.                 (*t->vector)(x-htic,y);
  238.                 (*t->vector)(x+htic,y);
  239.                 (*t->move)(x,y-vtic);
  240.                 (*t->vector)(x,y-vtic);
  241.                 (*t->vector)(x,y+vtic);
  242.                 (*t->move)(x-htic,y-vtic);
  243.                 (*t->vector)(x-htic,y-vtic);
  244.                 (*t->vector)(x+htic,y+vtic);
  245.                 (*t->move)(x-htic,y+vtic);
  246.                 (*t->vector)(x-htic,y+vtic);
  247.                 (*t->vector)(x+htic,y-vtic);
  248.                 break;
  249.     }
  250. }
  251.  
  252.  
  253. /*
  254.  * general point routine
  255.  */
  256. line_and_point(x,y,number)
  257. int x,y,number;
  258. {
  259.     /* temporary(?) kludge to allow terminals with bad linetypes 
  260.         to make nice marks */
  261.  
  262.     (*term_tbl[term].linetype)(NICE_LINE);
  263.     do_point(x,y,number);
  264. }
  265.  
  266. /* 
  267.  * general arrow routine
  268.  */
  269. #define ROOT2 (1.41421)        /* sqrt of 2 */
  270.  
  271. do_arrow(sx, sy, ex, ey, head)
  272.     int sx,sy;            /* start point */
  273.     int ex, ey;            /* end point (point of arrowhead) */
  274.     TBOOLEAN head;
  275. {
  276.     register struct termentry *t = &term_tbl[term];
  277.     int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  278.  
  279.     /* draw the line for the arrow. That's easy. */
  280.     (*t->move)(sx, sy);
  281.     (*t->vector)(ex, ey);
  282.  
  283.     if (head) {
  284.     /* now draw the arrow head. */
  285.     /* we put the arrowhead marks at 45 degrees to line */
  286.        if (sx == ex) {
  287.        /* vertical line, special case */
  288.           int delta = ((float)len / ROOT2 + 0.5);
  289.           if (sy < ey)
  290.               delta = -delta;    /* up arrow goes the other way */
  291.           (*t->move)(ex - delta, ey + delta);
  292.           (*t->vector)(ex,ey);
  293.           (*t->vector)(ex + delta, ey + delta);
  294.        } else {
  295.           int dx = sx - ex;
  296.           int dy = sy - ey;
  297.           double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  298.                    + (double)dy*(double)dy));
  299.           int x,y;            /* one endpoint */
  300.  
  301.           x = (int)( ex + (dx + dy) * coeff );
  302.           y = (int)( ey + (dy - dx) * coeff );
  303.           (*t->move)(x,y);
  304.           (*t->vector)(ex,ey);
  305.  
  306.           x = (int)( ex + (dx - dy) * coeff );
  307.           y = (int)( ey + (dy + dx) * coeff );
  308.           (*t->vector)(x,y);
  309.        }
  310.     }
  311. }
  312.  
  313. #ifdef DUMB                    /* paper or glass dumb terminal */
  314. #include "term/dumb.trm"
  315. #endif
  316.  
  317.  
  318. #ifndef _Windows
  319. # ifdef PC            /* all PC types except MS WINDOWS*/
  320. #  include "term/pc.trm"
  321. # endif
  322. #else
  323. #  include "term/win.trm"
  324. #endif
  325.  
  326. #ifdef __ZTC__
  327. #include "term/fg.trm"
  328. #endif
  329.  
  330. #ifdef DJSVGA
  331. #include "term/djsvga.trm"    /* DJGPP SVGA */
  332. #endif
  333.  
  334. #ifdef EMXVGA
  335. #include "term/emxvga.trm"    /* EMX VGA */
  336. #endif
  337.  
  338. #ifdef OS2PM                    /* os/2 presentation manager */
  339. #include "term/pm.trm"
  340. #endif
  341.  
  342. #ifdef ATARI            /* ATARI-ST */
  343. #include "term/atari.trm"
  344. #endif
  345.  
  346. /*
  347.    all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  348.    but most require various TEK routines.  Hence TEK must be defined for
  349.    the others to compile.
  350. */
  351. #ifdef BITGRAPH
  352. # ifndef TEK
  353. #  define TEK
  354. # endif
  355. #endif
  356.  
  357. #ifdef SELENAR
  358. # ifndef TEK
  359. #  define TEK
  360. # endif
  361. #endif
  362.  
  363. #ifdef KERMIT
  364. # ifndef TEK
  365. #  define TEK
  366. # endif
  367. #endif
  368.  
  369. #ifdef LN03P
  370. # ifndef TEK
  371. #  define TEK
  372. # endif
  373. #endif
  374.  
  375. #ifdef VTTEK
  376. # ifndef TEK
  377. #  define TEK
  378. # endif
  379. #endif
  380.  
  381. #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  382. #include "term/t410x.trm"
  383. #endif
  384.  
  385. #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  386. #ifdef THINK_C
  387. #include ":term:tek.trm"
  388. #else
  389. #include "term/tek.trm"
  390. #endif
  391. #endif
  392.  
  393. #ifdef OKIDATA
  394. #define EPSONP
  395. #endif
  396.  
  397. #ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  398. #include "term/epson.trm"
  399. #endif
  400.  
  401. #ifdef HP500C  /* HP 500 deskjet Colour */
  402. #ifdef THINK_C
  403. #include ":term:hp500c.trm"
  404. #else
  405. #include "term/hp500c.trm"
  406. #endif
  407. #endif
  408.  
  409. #ifdef HPLJII        /* HP LaserJet II */
  410. #include "term/hpljii.trm"
  411. #endif
  412.  
  413. #ifdef PCL /* HP LaserJet III in HPGL mode */
  414. #  ifndef HPGL
  415. #    define HPGL
  416. #  endif
  417. #endif
  418.  
  419. #ifdef HPPJ        /* HP PaintJet */
  420. #include "term/hppj.trm"
  421. #endif
  422.  
  423. #ifdef FIG            /* Fig 2.1 Interactive graphics program */
  424. #include "term/fig.trm"
  425. #include "term/bigfig.trm"
  426. #endif
  427.   
  428. #ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  429. #include "term/gpr.trm"
  430. #endif /* GPR */
  431.  
  432. #ifdef GRASS              /* GRASS (geographic info system) monitor */
  433. #include "term/grass.trm"
  434. #endif /* GRASS */
  435.  
  436. #ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  437. #include "term/apollo.trm"
  438. #endif /* APOLLO */
  439.  
  440. #ifdef IMAGEN        /* IMAGEN printer */
  441. #include "term/imagen.trm"
  442. #endif
  443.  
  444. #ifdef MIF            /* Framemaker MIF  driver */
  445. #ifdef THINK_C
  446. #include ":term:mif.trm"
  447. #else
  448. #include "term/mif.trm"
  449. #endif
  450. #endif
  451.  
  452. #ifdef MAC_TERM
  453. #include "Mac.c"
  454. #endif
  455.  
  456. #ifdef MF            /* METAFONT driver */
  457. #ifdef THINK_C
  458. #include ":term:metafont.trm"
  459. #else
  460. #include "term/metafont.trm"
  461. #endif
  462. #endif
  463.  
  464. #ifdef TEXDRAW
  465. #include "term/texdraw.trm"
  466. #endif
  467.  
  468. #ifdef EEPIC        /* EEPIC (LATEX) type */
  469. #ifdef THINK_C
  470. #include ":term:eepic.trm"
  471. #else
  472. #include "term/eepic.trm"
  473. #endif
  474. # ifndef LATEX
  475. #  define LATEX
  476. # endif
  477. #endif
  478.  
  479. #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  480. # ifndef LATEX
  481. #  define LATEX
  482. # endif
  483. #endif
  484.  
  485. #ifdef LATEX        /* LATEX type */
  486. #ifdef THINK_C
  487. #include ":term:latex.trm"
  488. #else
  489. #include "term/latex.trm"
  490. #endif
  491. #endif
  492.  
  493. #ifdef GPIC        /* GPIC (groff) type */ 
  494. #include "term/gpic.trm"
  495. #endif
  496.  
  497. #ifdef PBM        /* PBMPLUS portable bitmap */
  498. #ifdef THINK_C
  499. #include ":term:pbm.trm"
  500. #else
  501. #include "term/pbm.trm"
  502. #endif
  503. #endif
  504.  
  505. #ifdef POSTSCRIPT    /* POSTSCRIPT type */
  506. #ifdef THINK_C
  507. #include ":term:post.trm"
  508. #else
  509. #include "term/post.trm"
  510. #endif
  511. #endif
  512.  
  513. #ifdef PRESCRIBE    /* PRESCRIBE type */
  514. #include "term/kyo.trm"
  515. #endif
  516.  
  517. /* note: this must come after term/post.trm */
  518. #ifdef PSLATEX        /* LaTeX with embedded PostScript */
  519. #ifdef THINK_C
  520. #include ":term:pslatex.trm"
  521. #else
  522. #include "term/pslatex.trm"
  523. #endif
  524. #endif
  525.  
  526. #ifdef PSTRICKS
  527. #include "term/pstricks.trm"
  528. #endif
  529.  
  530. #ifdef TPIC        /* TPIC (LATEX) type */
  531. #ifdef THINK_C
  532. #include ":term:tpic.trm"
  533. #else
  534. #include "term/tpic.trm"
  535. #endif
  536. # ifndef LATEX
  537. #  define LATEX
  538. # endif
  539. #endif
  540.  
  541. #ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  542. #include "term/unixpc.trm"
  543. #endif /* UNIXPC */
  544.  
  545. #ifdef AED
  546. #include "term/aed.trm"
  547. #endif /* AED */
  548.  
  549. #ifdef AIFM
  550. #ifdef THINK_C
  551. #include ":term:ai.trm"
  552. #else
  553. #include "term/ai.trm"
  554. #endif
  555. #endif /* AIFM */
  556.  
  557. #ifdef COREL
  558. #include "term/corel.trm"
  559. #endif /* COREL */
  560.  
  561. #ifdef CGI
  562. #include "term/cgi.trm"
  563. #endif /* CGI */
  564.  
  565. #ifdef DEBUG
  566. #ifdef THINK_C
  567. #include ":term:debug.trm"
  568. #else
  569. #include "term/debug.trm"
  570. #endif
  571. #endif /* DEBUG */
  572.  
  573. #ifdef EXCL
  574. #ifdef THINK_C
  575. #include ":term:excl.trm"
  576. #else
  577. #include "term/excl.trm"
  578. #endif
  579. #endif /* EXCL */
  580.  
  581. #ifdef HP2648
  582. /* also works for HP2647 */
  583. #include "term/hp2648.trm"
  584. #endif /* HP2648 */
  585.  
  586. #ifdef HP26
  587. #include "term/hp26.trm"
  588. #endif /* HP26 */
  589.  
  590. #ifdef HP75
  591. #ifndef HPGL
  592. #define HPGL
  593. #endif
  594. #endif
  595.  
  596. /* HPGL - includes HP75 and HPLJIII in HPGL mode */
  597. #ifdef HPGL
  598. #include "term/hpgl.trm"
  599. #endif /* HPGL */
  600.  
  601. /* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  602.     and Russell Lang, rjl@monu1.cc.monash.oz */
  603. #ifdef DXY800A
  604. #include "term/dxy.trm"
  605. #endif /* DXY800A */
  606.  
  607. #ifdef IRIS4D
  608. #include "term/iris4d.trm"
  609. #endif /* IRIS4D */
  610.  
  611. #ifdef NEXT
  612. #include "term/next.trm"
  613. #endif /* NEXT */
  614.  
  615. #ifdef QMS
  616. #include "term/qms.trm"
  617. #endif /* QMS */
  618.  
  619. #ifdef REGIS
  620. #include "term/regis.trm"
  621. #endif /* REGIS */
  622.  
  623. #ifdef RGIP
  624. #include "term/rgip.trm"
  625. #endif /* RGIP UNIPLEX */
  626.  
  627. #ifdef MGR
  628. #include "term/mgr.trm"
  629. #endif /* MGR */
  630.  
  631. #ifdef SUN
  632. #include "term/sun.trm"
  633. #endif /* SUN */
  634.  
  635. #ifdef VWS
  636. #include "term/vws.trm"
  637. #endif /* VWS */
  638.  
  639. #ifdef V384
  640. #include "term/v384.trm"
  641. #endif /* V384 */
  642.  
  643. #ifdef TGIF
  644. #ifdef THINK_C
  645. #include ":term:tgif.trm"
  646. #else
  647. #include "term/tgif.trm"
  648. #endif
  649. #endif /* TGIF */
  650.  
  651. #ifdef UNIXPLOT
  652. #ifdef GNUGRAPH
  653. #include "term/gnugraph.trm"
  654. #else
  655. #include "term/unixplot.trm"
  656. #endif /* GNUGRAPH */
  657. #endif /* UNIXPLOT */
  658.  
  659. #ifdef X11
  660. #include "term/x11.trm"
  661. #include "term/xlib.trm"
  662. #endif /* X11 */
  663.  
  664. #ifdef DXF
  665. #ifdef THINK_C
  666. #include ":term:dxf.trm"
  667. #else
  668. #include "term/dxf.trm"
  669. #endif
  670. #endif /* DXF */
  671.   
  672. #ifdef AMIGASCREEN
  673. #include "term/amiga.trm"
  674. #endif /* AMIGASCREEN */
  675.  
  676. #ifdef THINK_C
  677.  #include "Mac.h"
  678. #endif 
  679.  
  680.  
  681. /* Dummy functions for unavailable features */
  682.  
  683. /* change angle of text.  0 is horizontal left to right.
  684. * 1 is vertical bottom to top (90 deg rotate)  
  685. */
  686. static int null_text_angle()
  687. {
  688. return FALSE ;    /* can't be done */
  689. }
  690.  
  691. /* change justification of text.  
  692.  * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  693.  */
  694. #ifdef THINK_C
  695. static int null_justify_text(enum JUSTIFY dummy)
  696. #else
  697. static int null_justify_text()
  698. #endif
  699. {
  700. return FALSE ;    /* can't be done */
  701. }
  702.  
  703.  
  704. /* Change scale of plot.
  705.  * Parameters are x,y scaling factors for this plot.
  706.  * Some terminals (eg latex) need to do scaling themselves.
  707.  */
  708. static int null_scale()
  709. {
  710. return FALSE ;    /* can't be done */
  711. }
  712.  
  713. static int do_scale()
  714. {
  715. return TRUE ;    /* can be done */
  716. }
  717.  
  718. options_null()
  719. {
  720.     term_options[0] = '\0';    /* we have no options */
  721. }
  722.  
  723. static UNKNOWN_null()
  724. {
  725. }
  726.  
  727. /*
  728.  * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  729.  *   first, since term is initialized to 0.
  730.  */
  731. struct termentry term_tbl[] = {
  732.     {"unknown", "Unknown terminal type - not a plotting device",
  733.       100, 100, 1, 1,
  734.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  735.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  736.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  737.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  738.  
  739.     ,{"table", "Dump ASCII table of X Y [Z] values to output",
  740.       100, 100, 1, 1,
  741.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  742.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  743.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  744.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  745.  
  746. #ifdef AMIGASCREEN
  747.     ,{"amiga", "Amiga Custom Screen",
  748.        AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  749.        AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  750.        AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  751.        AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  752.        AMIGA_justify_text, do_point, do_arrow}
  753. #endif
  754.  
  755. #ifdef ATARI
  756.     ,{"atari", "Atari ST/TT",
  757.        ATARI_XMAX, ATARI_YMAX, ATARI_VCHAR, ATARI_HCHAR, 
  758.        ATARI_VTIC, ATARI_HTIC, ATARI_options, ATARI_init, ATARI_reset, 
  759.        ATARI_text, null_scale, ATARI_graphics, ATARI_move, ATARI_vector, 
  760.        ATARI_linetype, ATARI_put_text, ATARI_text_angle, 
  761.        null_justify_text, ATARI_point, do_arrow}
  762. #endif
  763.  
  764. #ifdef DUMB
  765.     ,{"dumb", "printer or glass dumb terminal",
  766.          DUMB_XMAX, DUMB_YMAX, 1, 1,
  767.          1, 1, DUMB_options, DUMB_init, DUMB_reset,
  768.          DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  769.          DUMB_linetype, DUMB_put_text, null_text_angle,
  770.          null_justify_text, DUMB_point, DUMB_arrow}
  771. #endif
  772.  
  773. #ifdef PC
  774. #ifndef _Windows
  775. # ifdef __TURBOC__
  776. #ifdef ATT6300
  777.     ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  778.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  779.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  780.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  781.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  782.        ATT_justify_text, line_and_point, do_arrow}
  783. #endif
  784.  
  785.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  786.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  787.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  788.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  789.        CGA_linetype, CGA_put_text, MCGA_text_angle, 
  790.        CGA_justify_text, line_and_point, do_arrow}
  791.  
  792.     ,{"egalib", "IBM PC/Clone with EGA graphics board",
  793.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  794.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  795.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  796.        EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  797.        EGALIB_justify_text, do_point, do_arrow}
  798.  
  799.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  800.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  801.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  802.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  803.        HERC_linetype, HERC_put_text, MCGA_text_angle, 
  804.        HERC_justify_text, line_and_point, do_arrow}
  805.  
  806.     ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  807.        MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  808.        MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  809.        MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  810.        MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  811.        MCGA_justify_text, line_and_point, do_arrow}
  812.  
  813.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  814.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  815.        SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  816.        SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  817.        SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  818.        SVGA_justify_text, do_point, do_arrow}
  819.  
  820.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  821.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  822.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  823.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  824.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  825.        VGA_justify_text, do_point, do_arrow}
  826.  
  827.     ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  828.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  829.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  830.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  831.        VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  832.        VGA_justify_text, line_and_point, do_arrow}
  833. #else                    /* TURBO */
  834.  
  835. #ifdef ATT6300
  836.     ,{"att", "AT&T PC/6300 graphics",
  837.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  838.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  839.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  840.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  841.        null_justify_text, line_and_point, do_arrow}
  842. #endif
  843.  
  844.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  845.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  846.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  847.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  848.        CGA_linetype, CGA_put_text, CGA_text_angle, 
  849.        null_justify_text, line_and_point, do_arrow}
  850.  
  851. #ifdef CORONA
  852.     ,{"corona325", "Corona graphics ???",
  853.        COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  854.        COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  855.        COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  856.        COR_linetype, COR_put_text, COR_text_angle, 
  857.        null_justify_text, line_and_point, do_arrow}
  858. #endif                    /* CORONA */
  859.  
  860.     ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  861.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  862.        EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  863.        EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  864.        EGA_linetype, EGA_put_text, EGA_text_angle, 
  865.        null_justify_text, do_point, do_arrow}
  866.  
  867. #ifdef EGALIB
  868.     ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  869.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  870.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  871.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  872.        EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  873.        null_justify_text, do_point, do_arrow}
  874. #endif
  875.  
  876. #ifdef HERCULES
  877.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  878.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  879.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  880.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  881.        HERC_linetype, HERC_put_text, HERC_text_angle, 
  882.        null_justify_text, line_and_point, do_arrow}
  883. #endif                    /* HERCULES */
  884.  
  885.     ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  886.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  887.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  888.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  889.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  890.        null_justify_text, do_point, do_arrow}
  891.  
  892. #endif                    /* TURBO */
  893. #endif                    /* _Windows */
  894. #endif                    /* PC */
  895.  
  896. #ifdef __ZTC__         /* zortech C flashgraphics for 386 */
  897.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  898.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  899.        HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
  900.        VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
  901.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  902.        VGA_justify_text, do_point, do_arrow}
  903.  
  904.     ,{"egamono", "IBM PC/Clone with monochrome EGA graphics board",
  905.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  906.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  907.        VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
  908.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  909.        VGA_justify_text, do_point, do_arrow}
  910.  
  911.     ,{"egalib", "IBM PC/Clone with color EGA graphics board",
  912.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  913.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  914.        VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
  915.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  916.        VGA_justify_text, do_point, do_arrow}
  917.  
  918.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  919.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  920.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  921.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  922.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  923.        VGA_justify_text, do_point, do_arrow}
  924.  
  925.     ,{"vgamono", "IBM PC/Clone with monochrome VGA graphics board",
  926.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  927.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  928.        VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
  929.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  930.        VGA_justify_text, do_point, do_arrow}
  931.  
  932.     ,{"svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
  933.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  934.        SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
  935.        VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
  936.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  937.        VGA_justify_text, do_point, do_arrow}
  938.  
  939.     ,{"ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
  940.        SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
  941.        SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
  942.        VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
  943.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  944.        VGA_justify_text, do_point, do_arrow}
  945. #endif    /* __ZTC__ */
  946.  
  947. #ifdef AED
  948.     ,{"aed512", "AED 512 Terminal",
  949.        AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  950.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  951.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  952.        AED_linetype, AED_put_text, null_text_angle, 
  953.        null_justify_text, do_point, do_arrow}
  954.     ,{"aed767", "AED 767 Terminal",
  955.        AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  956.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  957.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  958.        AED_linetype, AED_put_text, null_text_angle, 
  959.        null_justify_text, do_point, do_arrow}
  960. #endif
  961.  
  962. #ifdef AIFM
  963.     ,{"aifm", "Adobe Illustrator 3.0 Format",
  964.        AI_XMAX, AI_YMAX, AI_VCHAR, AI_HCHAR, 
  965.        AI_VTIC, AI_HTIC, AI_options, AI_init, AI_reset, 
  966.        AI_text, null_scale, AI_graphics, AI_move, AI_vector, 
  967.        AI_linetype, AI_put_text, AI_text_angle, 
  968.        AI_justify_text, do_point, do_arrow}
  969. #endif
  970.  
  971. #ifdef APOLLO
  972.        ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  973.        0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  974.        APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  975.        APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  976.        APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  977.        APOLLO_justify_text, line_and_point, do_arrow}
  978. #endif
  979.  
  980. #ifdef GPR
  981.        ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  982.        GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  983.        GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  984.        GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  985.        GPR_linetype, GPR_put_text, GPR_text_angle,
  986.        GPR_justify_text, line_and_point, do_arrow}
  987. #endif
  988.  
  989. #ifdef BITGRAPH
  990.     ,{"bitgraph", "BBN Bitgraph Terminal",
  991.        BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  992.        BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  993.        BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  994.        BG_linetype, BG_put_text, null_text_angle, 
  995.        null_justify_text, line_and_point, do_arrow}
  996. #endif
  997.  
  998. #ifdef COREL
  999.     ,{"corel","EPS format for CorelDRAW",
  1000.      CORELD_XMAX, CORELD_YMAX, CORELD_VCHAR, CORELD_HCHAR,
  1001.      CORELD_VTIC, CORELD_HTIC, COREL_options, COREL_init, COREL_reset,
  1002.      COREL_text, null_scale, COREL_graphics, COREL_move, COREL_vector,
  1003.      COREL_linetype, COREL_put_text, COREL_text_angle,
  1004.      COREL_justify_text, do_point, do_arrow}
  1005. #endif
  1006.  
  1007. #ifdef CGI
  1008.     ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  1009.        CGI_XMAX, CGI_YMAX, 0, 0, 
  1010.        CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  1011.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  1012.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  1013.        CGI_justify_text, CGI_point, do_arrow}
  1014.  
  1015.     ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  1016.        CGI_XMAX, CGI_YMAX, 0, 0, 
  1017.        CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  1018.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  1019.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  1020.        CGI_justify_text, CGI_point, do_arrow}
  1021. #endif
  1022.  
  1023. #ifdef DEBUG
  1024.     ,{"debug", "debugging driver",
  1025.        DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
  1026.        DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
  1027.        DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
  1028.        DEBUG_linetype, DEBUG_put_text, null_text_angle, 
  1029.        DEBUG_justify_text, line_and_point, do_arrow}
  1030. #endif
  1031.  
  1032. #ifdef DJSVGA
  1033.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  1034.        DJSVGA_XMAX, DJSVGA_YMAX, DJSVGA_VCHAR, DJSVGA_HCHAR,
  1035.        DJSVGA_VTIC, DJSVGA_HTIC, options_null, DJSVGA_init, DJSVGA_reset,
  1036.        DJSVGA_text, null_scale, DJSVGA_graphics, DJSVGA_move, DJSVGA_vector,
  1037.        DJSVGA_linetype, DJSVGA_put_text, null_text_angle, 
  1038.        null_justify_text, do_point, do_arrow}
  1039. #endif
  1040.  
  1041. #ifdef DXF
  1042.     ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  1043.        DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  1044.        DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  1045.        DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  1046.        DXF_linetype, DXF_put_text, DXF_text_angle,
  1047.        DXF_justify_text, do_point, do_arrow}
  1048. #endif
  1049.  
  1050. #ifdef DXY800A
  1051.     ,{"dxy800a", "Roland DXY800A plotter",
  1052.        DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  1053.        DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  1054.        DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  1055.        DXY_linetype, DXY_put_text, DXY_text_angle, 
  1056.        null_justify_text, do_point, do_arrow}
  1057. #endif
  1058.  
  1059. #ifdef EEPIC
  1060.     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  1061.        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  1062.        EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  1063.        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  1064.        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  1065.        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  1066. #endif
  1067.  
  1068. #ifdef EMTEX
  1069.     ,{"emtex", "LaTeX picture environment with emTeX specials",
  1070.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1071.        LATEX_VTIC, LATEX_HTIC, LATEX_options, EMTEX_init, EMTEX_reset, 
  1072.        EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1073.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1074.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1075. #endif
  1076.  
  1077. #ifdef EPS180
  1078.     ,{"epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
  1079.        EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
  1080.        EPSON180VTIC, EPSON180HTIC, options_null, EPSONinit, EPSONreset,
  1081.        EPS180text, null_scale, EPS180graphics, EPSONmove, EPSONvector,
  1082.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1083.        null_justify_text, do_point, do_arrow}
  1084. #endif
  1085.  
  1086. #ifdef EPS60
  1087.     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  1088.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1089.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1090.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1091.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1092.        null_justify_text, do_point, do_arrow}
  1093. #endif
  1094.  
  1095. #ifdef EPSONP
  1096.     ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  1097.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  1098.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  1099.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  1100.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  1101.        null_justify_text, line_and_point, do_arrow}
  1102. #endif
  1103.  
  1104. #ifdef EXCL
  1105.     ,{"excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  1106.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  1107.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  1108.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  1109.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  1110.        null_justify_text, line_and_point, do_arrow}
  1111. #endif
  1112.  
  1113.  
  1114. #ifdef FIG
  1115.     ,{"fig", "FIG 2.1 graphics language: SunView or X graphics editor",
  1116.        FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1117.        FIG_VTIC, FIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1118.        FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1119.        FIG_linetype, FIG_put_text, FIG_text_angle, 
  1120.        FIG_justify_text, line_and_point, FIG_arrow}
  1121.     ,{"bfig", "FIG 2.1 graphics lang: SunView or X graphics editor. Large Graph",
  1122.        BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1123.        BFIG_VTIC, BFIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1124.        FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1125.        FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1126.        FIG_justify_text, line_and_point, BFIG_arrow}
  1127. #endif
  1128.  
  1129. #ifdef GPIC
  1130.     ,{"gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
  1131.        GPIC_XMAX, GPIC_YMAX, GPIC_VCHAR, GPIC_HCHAR, 
  1132.        GPIC_VTIC, GPIC_HTIC, GPIC_options, GPIC_init, GPIC_reset, 
  1133.        GPIC_text, GPIC_scale, GPIC_graphics, GPIC_move, GPIC_vector, 
  1134.        GPIC_linetype, GPIC_put_text, GPIC_text_angle, 
  1135.        GPIC_justify_text, line_and_point, GPIC_arrow}
  1136. #endif
  1137.  
  1138. #ifdef GRASS
  1139.     ,{"grass", "GRASS Graphics Monitor",
  1140.            GRASS_XMAX, GRASS_YMAX, GRASS_VCHAR, GRASS_HCHAR,
  1141.            GRASS_VTIC, GRASS_HTIC, GRASS_options, GRASS_init, GRASS_reset,
  1142.            GRASS_text, null_scale, GRASS_graphics, GRASS_move, GRASS_vector,
  1143.            GRASS_linetype, GRASS_put_text, GRASS_text_angle,
  1144.            GRASS_justify_text, GRASS_point, GRASS_arrow}
  1145. #endif
  1146.  
  1147. #ifdef HP26
  1148.     ,{"hp2623A", "HP2623A and maybe others",
  1149.        HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1150.        HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1151.        HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1152.        HP26_linetype, HP26_put_text, HP26_text_angle, 
  1153.        null_justify_text, HP26_line_and_point, do_arrow}
  1154. #endif
  1155.  
  1156. #ifdef HP2648
  1157.     ,{"hp2648", "HP2648 and HP2647",
  1158.        HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1159.        HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1160.        HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1161.        HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1162.        null_justify_text, line_and_point, do_arrow}
  1163. #endif
  1164.  
  1165. #ifdef HP75
  1166.     ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1167.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1168.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1169.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1170.        HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1171.        null_justify_text, do_point, do_arrow}
  1172. #endif
  1173.  
  1174. #ifdef HP500C
  1175.       ,{"hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
  1176.        HP500C_75PPI_XMAX, HP500C_75PPI_YMAX, HP500C_75PPI_VCHAR,
  1177.        HP500C_75PPI_HCHAR, HP500C_75PPI_VTIC, HP500C_75PPI_HTIC, HP500Coptions,
  1178.        HP500Cinit, HP500Creset, HP500Ctext, null_scale,
  1179.        HP500Cgraphics, HP500Cmove, HP500Cvector, HP500Clinetype,
  1180.        HP500Cput_text, HP500Ctext_angle, null_justify_text, do_point,
  1181.        do_arrow}
  1182. #endif
  1183.  
  1184. #ifdef HPGL
  1185.     ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1186.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1187.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1188.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1189.        HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1190.        null_justify_text, do_point, do_arrow}
  1191. #endif
  1192.  
  1193. #ifdef HPLJII
  1194.     ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1195.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1196.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1197.        HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1198.        HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1199.        HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1200.        do_arrow}
  1201.     ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1202.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1203.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1204.        HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1205.        HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1206.        HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1207.        do_arrow}
  1208. #endif
  1209.  
  1210. #ifdef HPPJ
  1211.     ,{"hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
  1212.        HPPJ_XMAX, HPPJ_YMAX,
  1213.        HPPJ_9x17_VCHAR, HPPJ_9x17_HCHAR, HPPJ_9x17_VTIC, HPPJ_9x17_HTIC,
  1214.        HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
  1215.        HPPJmove, HPPJvector, HPPJlinetype, HPPJput_text, HPPJtext_angle,
  1216.        null_justify_text, do_point, do_arrow}
  1217. #endif
  1218.  
  1219. #ifdef IMAGEN
  1220.     ,{"imagen", "Imagen laser printer",
  1221.        IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1222.        IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1223.        IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1224.        IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1225.        IMAGEN_justify_text, line_and_point, do_arrow}
  1226. #endif
  1227.  
  1228. #ifdef IRIS4D
  1229.     ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1230.        IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1231.        IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1232.        IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1233.        IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1234.        null_justify_text, do_point, do_arrow}
  1235. #endif
  1236.  
  1237. #ifdef KERMIT
  1238.     ,{"kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
  1239.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1240.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1241.        KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1242.        KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1243.        null_justify_text, do_point, do_arrow}
  1244.     ,{"km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
  1245.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1246.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1247.        TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1248.        KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1249.        null_justify_text, line_and_point, do_arrow}
  1250. #endif
  1251.  
  1252. #ifdef LATEX
  1253.     ,{"latex", "LaTeX picture environment",
  1254.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1255.        LATEX_VTIC, LATEX_HTIC, LATEX_options, LATEX_init, LATEX_reset, 
  1256.        LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1257.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1258.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1259. #endif
  1260.  
  1261. #ifdef LN03P
  1262.      ,{"ln03", "LN03-plus laser printer in tektronix (EGM) mode",
  1263.     LN03PXMAX, LN03PYMAX, LN03PVCHAR, LN03PHCHAR,
  1264.     LN03PVTIC, LN03PHTIC, options_null, LN03Pinit, LN03Preset,
  1265.     LN03Ptext, null_scale, TEK40graphics, LN03Pmove, LN03Pvector,
  1266.     LN03Plinetype, LN03Pput_text, null_text_angle,
  1267.     null_justify_text, line_and_point, do_arrow}
  1268. #endif
  1269.  
  1270. #ifdef MF
  1271.     ,{"mf", "Metafont plotting standard",
  1272.        MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR, 
  1273.        MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset, 
  1274.        MF_text, MF_scale, MF_graphics, MF_move, MF_vector, 
  1275.        MF_linetype, MF_put_text, MF_text_angle, 
  1276.        MF_justify_text, line_and_point, MF_arrow}
  1277. #endif
  1278.  
  1279. #ifdef MGR
  1280.     ,{"mgr", "Mgr window system",
  1281.     /* dimensions nominal, replaced during MGR_graphics call */
  1282.        MGR_XMAX, MGR_YMAX, MGR_VCHAR, MGR_HCHAR, 
  1283.        MGR_VTIC, MGR_HTIC, options_null, MGR_init, MGR_reset, 
  1284.        MGR_text, null_scale, MGR_graphics, MGR_move, MGR_vector,
  1285.        MGR_linetype, MGR_put_text, null_text_angle, 
  1286.        null_justify_text, do_point, do_arrow}
  1287. #endif
  1288.  
  1289. #ifdef MIF
  1290.     ,{"mif", "Frame maker MIF 3.00 format",
  1291.           MIF_XMAX, MIF_YMAX, MIF_VCHAR, MIF_HCHAR, 
  1292.          MIF_VTIC, MIF_HTIC, MIF_options, MIF_init, MIF_reset, 
  1293.         MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector, 
  1294.         MIF_linetype, MIF_put_text, MIF_text_angle, 
  1295.         MIF_justify_text, line_and_point, do_arrow}
  1296. #endif
  1297.  
  1298. #ifdef NEC
  1299.     ,{"nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  1300.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1301.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  1302.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  1303.        NEClinetype, NECput_text, NEC_text_angle, 
  1304.        null_justify_text, line_and_point, do_arrow}
  1305. #endif
  1306.  
  1307. #ifdef NEXT
  1308.     ,{"next", "NeXTstep window system",
  1309.        NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR, 
  1310.        NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset, 
  1311.        NEXT_text, do_scale, NEXT_graphics, NEXT_move, NEXT_vector, 
  1312.        NEXT_linetype, NEXT_put_text, NEXT_text_angle, 
  1313.        NEXT_justify_text, NEXT_point, do_arrow}
  1314. #endif /* The PostScript driver with NXImage displaying the PostScript on screen */
  1315.  
  1316. #ifdef OKIDATA
  1317.     ,{"okidata", "OKIDATA 320/321 Standard",
  1318.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1319.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1320.        OKIDATAtext, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1321.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1322.        null_justify_text, do_point, do_arrow}
  1323. #endif
  1324.  
  1325. #ifdef OS2PM
  1326.     ,{"pm", "OS/2 Presentation Manager",
  1327.        PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR, 
  1328.        PM_VTIC, PM_HTIC, PM_args, PM_init, PM_reset, 
  1329.        PM_text, null_scale, PM_graphics, PM_move, PM_vector,
  1330.        PM_linetype, PM_put_text, PM_text_angle, 
  1331.        PM_justify_text, PM_point, do_arrow}
  1332. #endif
  1333.  
  1334. #ifdef PBM
  1335.     ,{"pbm", "Portable bitmap [small medium large] [monochrome gray color]",
  1336.        PBM_XMAX, PBM_YMAX, PBM_VCHAR,
  1337.        PBM_HCHAR, PBM_VTIC, PBM_HTIC, PBMoptions,
  1338.        PBMinit, PBMreset, PBMtext, null_scale,
  1339.        PBMgraphics, PBMmove, PBMvector, PBMlinetype,
  1340.        PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
  1341.        do_arrow}
  1342. #endif
  1343.  
  1344. #ifdef PCL
  1345.  ,{"pcl5", "HP LaserJet III [mode] [font] [point]",
  1346.    PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
  1347.    PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
  1348.    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
  1349.    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
  1350.    HPGL2_justify_text, do_point, do_arrow}
  1351. #endif
  1352.  
  1353. #ifdef POSTSCRIPT
  1354.     ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1355.        PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1356.        PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1357.        PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
  1358.        PS_linetype, PS_put_text, PS_text_angle, 
  1359.        PS_justify_text, PS_point, do_arrow}
  1360. #endif
  1361.  
  1362. #ifdef PRESCRIBE
  1363.     ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1364.     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1365.     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1366.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1367.     PRE_linetype, PRE_put_text, null_text_angle, 
  1368.     PRE_justify_text, line_and_point, do_arrow}
  1369.     ,{"kyo", "Kyocera Laser Printer with Courier font",
  1370.     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1371.     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1372.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1373.     PRE_linetype, PRE_put_text, null_text_angle, 
  1374.     PRE_justify_text, line_and_point, do_arrow}
  1375. #endif /* PRESCRIBE */
  1376.  
  1377. #ifdef PSLATEX
  1378.     ,{"pslatex", "LaTeX picture environment with PostScript \\specials",
  1379.     PS_XMAX, PS_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
  1380.     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
  1381.     PSLATEX_text, PSLATEX_scale, PSLATEX_graphics, PS_move, PS_vector,
  1382.     PS_linetype, PSLATEX_put_text, PSLATEX_text_angle,
  1383.     PSLATEX_justify_text, PS_point, do_arrow}
  1384. #endif
  1385.  
  1386. #ifdef    PSTRICKS
  1387.     ,{"pstricks", "LaTeX picture environment with PSTricks macros",
  1388.        PSTRICKS_XMAX, PSTRICKS_YMAX, PSTRICKS_VCHAR, PSTRICKS_HCHAR, 
  1389.        PSTRICKS_VTIC, PSTRICKS_HTIC, options_null, PSTRICKS_init, PSTRICKS_reset, 
  1390.        PSTRICKS_text, PSTRICKS_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector, 
  1391.        PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle, 
  1392.        PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow}
  1393. #endif
  1394.     
  1395. #ifdef QMS
  1396.     ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1397.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1398.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1399.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1400.        QMS_linetype,QMS_put_text, null_text_angle, 
  1401.        null_justify_text, line_and_point, do_arrow}
  1402. #endif
  1403.  
  1404. #ifdef REGIS
  1405.     ,{"regis", "REGIS graphics language",
  1406.        REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1407.        REGISVTIC, REGISHTIC, REGISoptions, REGISinit, REGISreset, 
  1408.        REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1409.        REGISlinetype, REGISput_text, REGIStext_angle, 
  1410.        null_justify_text, line_and_point, do_arrow}
  1411. #endif
  1412.  
  1413. #ifdef RGIP
  1414.     ,{"rgip", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1415.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1416.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1417.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1418.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1419.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1420.     ,{"uniplex", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1421.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1422.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1423.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1424.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1425.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1426. #endif
  1427.  
  1428. #ifdef SELANAR
  1429.     ,{"selanar", "Selanar",
  1430.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1431.        TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1432.        SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1433.        TEK40linetype, TEK40put_text, null_text_angle, 
  1434.        null_justify_text, line_and_point, do_arrow}
  1435. #endif
  1436.  
  1437. #ifdef STARC
  1438.     ,{"starc", "Star Color Printer",
  1439.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1440.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1441.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1442.        STARClinetype, STARCput_text, STARC_text_angle, 
  1443.        null_justify_text, line_and_point, do_arrow}
  1444. #endif
  1445.  
  1446. #ifdef SUN
  1447.     ,{"sun", "SunView window system",
  1448.        SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1449.        SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1450.        SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1451.        SUN_linetype, SUN_put_text, null_text_angle, 
  1452.        SUN_justify_text, line_and_point, do_arrow}
  1453. #endif
  1454.  
  1455. #ifdef VWS
  1456.     ,{"VWS", "VAX Windowing System (UIS)",
  1457.            VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1458.            VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1459.            VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1460.            VWS_linetype, VWS_put_text, VWS_text_angle,
  1461.            VWS_justify_text, do_point, do_arrow}
  1462. #endif
  1463.  
  1464. #ifdef TANDY60
  1465.     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1466.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1467.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1468.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1469.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1470.        null_justify_text, do_point, do_arrow}
  1471. #endif
  1472.  
  1473. #ifdef T410X
  1474.     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1475.        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1476.        T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1477.        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1478.        T410X_linetype, T410X_put_text, T410X_text_angle, 
  1479.        null_justify_text, T410X_point, do_arrow}
  1480. #endif
  1481.  
  1482. #ifdef TEK
  1483.     ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1484.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1485.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1486.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1487.        TEK40linetype, TEK40put_text, null_text_angle, 
  1488.        null_justify_text, line_and_point, do_arrow}
  1489. #endif
  1490.  
  1491. #ifdef TEXDRAW
  1492.     ,{"texdraw", "LaTeX texdraw environment",
  1493.        TEXDRAW_XMAX, TEXDRAW_YMAX, TEXDRAW_VCHAR, TEXDRAW_HCHAR,
  1494.     TEXDRAW_VTIC, TEXDRAW_HTIC, options_null, TEXDRAW_init, TEXDRAW_reset,
  1495.     TEXDRAW_text, TEXDRAW_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
  1496.     TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
  1497.     TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow}
  1498. #endif
  1499.   
  1500. #ifdef TGIF
  1501.     ,{"tgif", "TGIF X-Window draw tool (file version 10)",
  1502.        TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR1, TGIF_HCHAR1, 
  1503.        TGIF_VTIC, TGIF_HTIC, options_null, TGIF_init, TGIF_reset, 
  1504.        TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector, 
  1505.        TGIF_linetype, TGIF_put_text, TGIF_text_angle, 
  1506.        TGIF_justify_text, line_and_point, TGIF_arrow}
  1507. #endif
  1508.  
  1509. #ifdef TPIC
  1510.     ,{"tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
  1511.        TPIC_XMAX, TPIC_YMAX, TPIC_VCHAR, TPIC_HCHAR, 
  1512.        TPIC_VTIC, TPIC_HTIC, TPIC_options, TPIC_init, TPIC_reset, 
  1513.        TPIC_text, TPIC_scale, TPIC_graphics, TPIC_move, TPIC_vector, 
  1514.        TPIC_linetype, TPIC_put_text, TPIC_text_angle, 
  1515.        TPIC_justify_text, TPIC_point, TPIC_arrow}
  1516. #endif
  1517.  
  1518. #ifdef UNIXPLOT
  1519. #ifdef GNUGRAPH
  1520.     ,{"unixplot", "GNU plot(1) format [\042fontname\042 font_size]",
  1521.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  1522.        UP_VTIC, UP_HTIC, UP_options, UP_init, UP_reset,
  1523.        UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  1524.        UP_linetype, UP_put_text, UP_text_angle,
  1525.        UP_justify_text, line_and_point, do_arrow}
  1526. #else
  1527.     ,{"unixplot", "Unix plotting standard (see plot(1))",
  1528.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1529.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1530.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1531.        UP_linetype, UP_put_text, null_text_angle, 
  1532.        null_justify_text, line_and_point, do_arrow}
  1533. #endif /* GNUGRAPH */
  1534. #endif
  1535.     
  1536. #ifdef UNIXPC
  1537.     ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1538.        uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1539.        uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1540.        uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1541.        uPC_linetype, uPC_put_text, uPC_text_angle, 
  1542.        null_justify_text, line_and_point, do_arrow}
  1543. #endif
  1544.  
  1545. #ifdef EMXVGA
  1546. #ifdef EMXVESA
  1547.     ,{"vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
  1548.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1549.        EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
  1550.        EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
  1551.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1552.        null_justify_text, do_point, do_arrow}
  1553. #endif
  1554.     ,{"vgal", "IBM PC/Clone with VGA graphics board",
  1555.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1556.        EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
  1557.        EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
  1558.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1559.        null_justify_text, do_point, do_arrow}
  1560. #endif
  1561.  
  1562. #ifdef V384
  1563.     ,{"vx384", "Vectrix 384 and Tandy color printer",
  1564.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1565.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1566.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1567.        V384_linetype, V384_put_text, null_text_angle, 
  1568.        null_justify_text, do_point, do_arrow}
  1569. #endif
  1570.  
  1571. #ifdef VTTEK
  1572.     ,{"vttek", "VT-like tek40xx terminal emulator",
  1573.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1574.        TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1575.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1576.        VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1577.        null_justify_text, line_and_point, do_arrow}
  1578. #endif
  1579.  
  1580. #ifdef _Windows
  1581.     ,{"windows", "Microsoft Windows",
  1582.        WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR, 
  1583.        WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset, 
  1584.        WIN_text, WIN_scale, WIN_graphics, WIN_move, WIN_vector,
  1585.        WIN_linetype, WIN_put_text, WIN_text_angle, 
  1586.        WIN_justify_text, WIN_point, do_arrow}
  1587. #endif
  1588.  
  1589. #ifdef X11
  1590.     ,{"x11", "X11 Window System",
  1591.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1592.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1593.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1594.        X11_linetype, X11_put_text, null_text_angle, 
  1595.        X11_justify_text, X11_point, do_arrow}
  1596.     ,{"X11", "X11 Window System (identical to x11)",
  1597.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1598.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1599.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1600.        X11_linetype, X11_put_text, null_text_angle, 
  1601.        X11_justify_text, X11_point, do_arrow}
  1602.    ,{"xlib", "X11 Window System (gnulib_x11 dump)",
  1603.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  1604.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  1605.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  1606.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  1607.        Xlib_justify_text, line_and_point, do_arrow}
  1608. #endif
  1609.  
  1610. #ifdef THINK_C
  1611.      ,{"mac", "Macintosh Graphic Window",
  1612.        MAC_XMAX, MAC_YMAX, MAC_VCHAR, MAC_HCHAR, 
  1613.        MAC_VTIC, MAC_HTIC, options_null,MAC_init, MAC_reset, 
  1614.        MAC_text, null_scale, MAC_graphics, MAC_move, MAC_vector,
  1615.        MAC_linetype, MAC_put_text, null_text_angle, 
  1616.        null_justify_text, line_and_point, do_arrow} 
  1617. #endif
  1618.  
  1619. };
  1620.  
  1621. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1622.  
  1623.  
  1624. list_terms()
  1625. {
  1626. register int i;
  1627.  
  1628.     fprintf(stderr,"\nAvailable terminal types:\n");
  1629.     for (i = 0; i < TERMCOUNT; i++)
  1630.         fprintf(stderr,"  %15s  %s\n",
  1631.                term_tbl[i].name, term_tbl[i].description);
  1632.     (void) putc('\n',stderr);
  1633. }
  1634.  
  1635.  
  1636. /* set_term: get terminal number from name on command line */
  1637. /* will change 'term' variable if successful */
  1638. int                        /* term number */
  1639. set_term(c_token)
  1640. int c_token;
  1641. {
  1642.     register int t;
  1643.     char *input_name;
  1644.  
  1645.     if (!token[c_token].is_token)
  1646.      int_error("terminal name expected",c_token);
  1647.     t = -1;
  1648.     input_name = input_line + token[c_token].start_index;
  1649.     t = change_term(input_name, token[c_token].length);
  1650.     if (t == -1)
  1651.      int_error("unknown terminal type; type just 'set terminal' for a list",
  1652.              c_token);
  1653.     if (t == -2)
  1654.      int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1655.              c_token);
  1656.  
  1657.     /* otherwise the type was changed */
  1658.  
  1659.     return(t);
  1660. }
  1661.  
  1662. /* change_term: get terminal number from name and set terminal type */
  1663. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1664. int
  1665. change_term(name, length)
  1666.     char *name;
  1667.     int length;
  1668. {
  1669.     int i, t = -1;
  1670.  
  1671.     for (i = 0; i < TERMCOUNT; i++) {
  1672.        if (!strncmp(name,term_tbl[i].name,length)) {
  1673.           if (t != -1)
  1674.             return(-2);    /* ambiguous */
  1675.           t = i;
  1676.        }
  1677.     }
  1678.  
  1679.     if (t == -1)            /* unknown */
  1680.      return(t);
  1681.  
  1682.     /* Success: set terminal type now */
  1683.  
  1684.     term = t;
  1685.     term_init = FALSE;
  1686.     name = term_tbl[term].name;
  1687.  
  1688.     /* Special handling for unixplot term type */
  1689.     if (!strncmp("unixplot",name,8)) {
  1690.        UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1691.     } else if (unixplot) {
  1692.        UP_redirect (3);  /* Put stdout back together again. */
  1693.     }
  1694.  
  1695.     if (interactive)
  1696.      fprintf(stderr, "Terminal type set to '%s'\n", name);
  1697.  
  1698.     return(t);
  1699. }
  1700.  
  1701. /*
  1702.    Routine to detect what terminal is being used (or do anything else
  1703.    that would be nice).  One anticipated (or allowed for) side effect
  1704.    is that the global ``term'' may be set. 
  1705.    The environment variable GNUTERM is checked first; if that does
  1706.    not exist, then the terminal hardware is checked, if possible, 
  1707.    and finally, we can check $TERM for some kinds of terminals.
  1708.    A default can be set with -DDEFAULTTERM=myterm in the Makefile
  1709.    or #define DEFAULTTERM myterm in term.h
  1710. */
  1711. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1712. init_terminal()
  1713. {
  1714.     int t;
  1715. #ifdef DEFAULTTERM
  1716.     char *term_name = DEFAULTTERM;
  1717. #else
  1718.     char *term_name = NULL;
  1719. #endif /* DEFAULTTERM */
  1720. #if (defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)) || defined(NEXT) || defined(SUN) || defined(X11)
  1721.     char *term = NULL;        /* from TERM environment var */
  1722. #endif
  1723. #ifdef X11
  1724.     char *display = NULL;
  1725. #endif
  1726.     char *gnuterm = NULL;
  1727.  
  1728.     /* GNUTERM environment variable is primary */
  1729.     gnuterm = getenv("GNUTERM");
  1730.     if (gnuterm != (char *)NULL) {
  1731.      term_name = gnuterm;
  1732. #ifndef _Windows
  1733. #if defined(__TURBOC__) && defined(MSDOS)
  1734.          get_path();   /* So *_init() can find the BGI driver */
  1735. # endif
  1736. #endif
  1737.     }
  1738.     else {
  1739. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  1740.        term_name = turboc_init();
  1741.        term = (char *)NULL; /* shut up turbo C */
  1742. #endif
  1743.        
  1744. #ifdef __ZTC__
  1745.       term_name = ztc_init();
  1746. #endif
  1747.  
  1748. #ifdef vms
  1749.        term_name = vms_init();
  1750. #endif
  1751.  
  1752. #ifdef NEXT
  1753.     term = getenv("TERM");
  1754.     if (term_name == (char *)NULL
  1755.         && term != (char *)NULL && strcmp(term,"next") == 0)
  1756.           term_name = "next";
  1757. #endif /* NeXT */
  1758.        
  1759. #ifdef SUN
  1760.        term = getenv("TERM");    /* try $TERM */
  1761.        if (term_name == (char *)NULL
  1762.           && term != (char *)NULL && strcmp(term, "sun") == 0)
  1763.         term_name = "sun";
  1764. #endif /* sun */
  1765.  
  1766. #ifdef _Windows
  1767.         term_name = "win";
  1768. #endif /* _Windows */
  1769.  
  1770. #ifdef GPR
  1771.    if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1772. #else
  1773. #ifdef APOLLO
  1774.    if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1775. #endif /* APOLLO */
  1776. #endif /* GPR    */
  1777.  
  1778. #ifdef X11
  1779.        term = getenv("TERM");    /* try $TERM */
  1780.        if (term_name == (char *)NULL
  1781.           && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1782.         term_name = "x11";
  1783.        display = getenv("DISPLAY");
  1784.        if (term_name == (char *)NULL && display != (char *)NULL)
  1785.         term_name = "x11";
  1786.        if (X11_Display)
  1787.         term_name = "x11";
  1788. #endif /* x11 */
  1789.  
  1790. #ifdef AMIGASCREEN
  1791.        term_name = "amiga";
  1792. #endif
  1793.  
  1794. #ifdef ATARI
  1795.        term_name = "atari";
  1796. #endif
  1797.  
  1798. #ifdef UNIXPC
  1799.            if (iswind() == 0) {
  1800.               term_name = "unixpc";
  1801.            }
  1802. #endif /* unixpc */
  1803.  
  1804. #ifdef CGI
  1805.        if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1806.          term_name = "cgi";
  1807. #endif /*CGI */
  1808.  
  1809. #if defined(MSDOS) && defined(__EMX__)
  1810. #ifdef EMXVESA
  1811.        term_name = "vesa";
  1812. #else
  1813.        term_name = "vgal";
  1814. #endif
  1815. #endif
  1816.  
  1817. #ifdef DJGPP
  1818.         term_name = "svga";
  1819. #endif
  1820.  
  1821. #ifdef GRASS
  1822.         term_name = "grass";
  1823. #endif
  1824.  
  1825. #ifdef OS2
  1826.            term_name = "pm" ;
  1827.             /* EMX compiler has getcwd that can return drive */
  1828.            if( PM_path[0]=='\0' ) _getcwd2( PM_path, 256 ) ;
  1829. #endif /*OS2 */           
  1830.     }
  1831.  
  1832.     /* We have a name, try to set term type */
  1833.     if (term_name != NULL && *term_name != '\0') {
  1834.        t = change_term(term_name, (int)strlen(term_name));
  1835.        if (t == -1)
  1836.         fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1837.        else if (t == -2)
  1838.         fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1839.        else                /* successful */
  1840.         ;
  1841.     }
  1842. }
  1843.  
  1844.  
  1845. #ifndef _Windows
  1846. #if defined (__TURBOC__) && defined (MSDOS)
  1847. char *
  1848. turboc_init()
  1849. {
  1850.   int g_driver,g_mode;
  1851.   char far *c1,*c2;
  1852.   char *term_name = NULL;
  1853.   struct text_info tinfo;       /* So we can restore starting text mode. */
  1854.  
  1855. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1856.     g_driver=DETECT;
  1857.           get_path();
  1858.     gettextinfo(&tinfo);
  1859.         initgraph(&g_driver,&g_mode,path);
  1860.         c1=getdrivername();
  1861.         c2=getmodename(g_mode);
  1862.           switch (g_driver){
  1863.             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1864.                      break;
  1865.             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1866.                      break;
  1867.             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1868.                      break;
  1869.             case -5: fprintf(stderr,"Insufficient memory to load ",
  1870.                              "graphics driver.");
  1871.                      break;
  1872.             case 1 : term_name = "cga";
  1873.                      break;
  1874.             case 2 : term_name = "mcga";
  1875.                      break;
  1876.             case 3 : 
  1877.             case 4 : term_name = "egalib";
  1878.                      break;
  1879.             case 7 : term_name = "hercules";
  1880.                      break;
  1881.             case 8 : term_name = "att";
  1882.                      break;
  1883.             case 9 : term_name = "vgalib";
  1884.                      break;
  1885.             }
  1886.         closegraph();
  1887.         textmode(tinfo.currmode);
  1888.     clrscr();
  1889.     fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1890.   return(term_name);
  1891. }
  1892. # endif /* __TURBOC__ */
  1893. #endif
  1894.  
  1895. #if defined(__ZTC__)
  1896. char *
  1897. ztc_init()
  1898. {
  1899.   int g_mode;
  1900.   char *term_name = NULL;
  1901.  
  1902.     g_mode = fg_init();
  1903.  
  1904.           switch (g_mode){
  1905.             case FG_NULL      :  fprintf(stderr,"Graphics card not detected or not supported.\n");
  1906.                                  exit(1);
  1907.             case FG_HERCFULL  :  term_name = "hercules";
  1908.                                  break;
  1909.             case FG_EGAMONO   :  term_name = "egamono";
  1910.                                  break;
  1911.             case FG_EGAECD      :  term_name = "egalib";
  1912.                                  break;
  1913.             case FG_VGA11      :  term_name = "vgamono";
  1914.                                  break;
  1915.             case FG_VGA12      :  term_name = "vgalib";
  1916.                                  break;
  1917.             case FG_VESA6A      :  term_name = "svgalib";
  1918.                                  break;
  1919.             case FG_VESA5      :  term_name = "ssvgalib";
  1920.                                  break;
  1921.             }
  1922.         fg_term();
  1923.   return(term_name);
  1924. }
  1925. #endif /* __ZTC__ */
  1926.  
  1927.  
  1928. /*
  1929.     This is always defined so we don't have to have command.c know if it
  1930.     is there or not.
  1931. */
  1932. #ifndef UNIXPLOT
  1933. UP_redirect(caller) int caller; 
  1934. {
  1935.     caller = caller;    /* to stop Turbo C complaining 
  1936.                          * about caller not being used */
  1937. }
  1938. #else
  1939. UP_redirect (caller)
  1940. int caller;
  1941. /*
  1942.     Unixplot can't really write to outfile--it wants to write to stdout.
  1943.     This is normally ok, but the original design of gnuplot gives us
  1944.     little choice.  Originally users of unixplot had to anticipate
  1945.     their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1946.  
  1947.     caller:  1 - called from SET OUTPUT "FOO.OUT"
  1948.              2 - called from SET TERM UNIXPLOT
  1949.              3 - called from SET TERM other
  1950.              4 - called from SET OUTPUT
  1951. */
  1952. {
  1953.     switch (caller) {
  1954.     case 1:
  1955.     /* Don't save, just replace stdout w/outfile (save was already done). */
  1956.         if (unixplot)
  1957.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1958.     break;
  1959.     case 2:
  1960.         if (!unixplot) {
  1961.             fflush(stdout);
  1962.             save_stdout = *(stdout);
  1963.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1964.             unixplot = 1;
  1965.         }
  1966.     break;
  1967.     case 3:
  1968.     /* New terminal in use--put stdout back to original. */
  1969.         /* closepl(); */  /* This is called by the term. */
  1970.         fflush(stdout);
  1971.         *(stdout) = save_stdout;  /* Copy FILE structure */
  1972.         unixplot = 0;
  1973.     break;
  1974.     case 4:
  1975.     /*  User really wants to go to normal output... */
  1976.         if (unixplot) {
  1977.             fflush(stdout);
  1978.             *(stdout) = save_stdout;  /* Copy FILE structure */
  1979.         }
  1980.     break;
  1981.     }
  1982. }
  1983. #endif
  1984.  
  1985.  
  1986. /* test terminal by drawing border and text */
  1987. /* called from command test */
  1988. test_term()
  1989. {
  1990.     register struct termentry *t = &term_tbl[term];
  1991.     char *str;
  1992.     int x,y, xl,yl, i;
  1993.     unsigned int xmax, ymax;
  1994.     char label[MAX_ID_LEN];
  1995.     int scaling;
  1996.  
  1997.     if (!term_init) {
  1998.        (*t->init)();
  1999.        term_init = TRUE;
  2000.     }
  2001.     screen_ok = FALSE;
  2002.     scaling = (*t->scale)(xsize, ysize);
  2003.     xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  2004.     ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  2005.     (*t->graphics)();
  2006.     /* border linetype */
  2007.     (*t->linetype)(-2);
  2008.     (*t->move)(0,0);
  2009.     (*t->vector)(xmax-1,0);
  2010.     (*t->vector)(xmax-1,ymax-1);
  2011.     (*t->vector)(0,ymax-1);
  2012.     (*t->vector)(0,0);
  2013.     (void) (*t->justify_text)(LEFT);
  2014.     (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  2015.     /* axis linetype */
  2016.     (*t->linetype)(-1);
  2017.     (*t->move)(xmax/2,0);
  2018.     (*t->vector)(xmax/2,ymax-1);
  2019.     (*t->move)(0,ymax/2);
  2020.     (*t->vector)(xmax-1,ymax/2);
  2021.     /* test width and height of characters */
  2022.     (*t->linetype)(-2);
  2023.     (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  2024.     (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  2025.     (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  2026.     (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  2027.     (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  2028.     (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  2029.         "12345678901234567890");
  2030.     /* test justification */
  2031.     (void) (*t->justify_text)(LEFT);
  2032.     (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  2033.     str = "centre+d text";
  2034.     if ((*t->justify_text)(CENTRE))
  2035.         (*t->put_text)(xmax/2,
  2036.                 ymax/2+t->v_char*5,str);
  2037.     else
  2038.         (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  2039.                 ymax/2+t->v_char*5,str);
  2040.     str = "right justified";
  2041.     if ((*t->justify_text)(RIGHT))
  2042.         (*t->put_text)(xmax/2,
  2043.                 ymax/2+t->v_char*4,str);
  2044.     else
  2045.         (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  2046.                 ymax/2+t->v_char*4,str);
  2047.     /* test text angle */
  2048.     str = "rotated ce+ntred text";
  2049.     if ((*t->text_angle)(1)) {
  2050.         if ((*t->justify_text)(CENTRE))
  2051.             (*t->put_text)(t->v_char,
  2052.                 ymax/2,str);
  2053.         else
  2054.             (*t->put_text)(t->v_char,
  2055.                 ymax/2-strlen(str)*t->h_char/2,str);
  2056.     }
  2057.     else {
  2058.         (void) (*t->justify_text)(LEFT);
  2059.         (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  2060.     }
  2061.     (void) (*t->justify_text)(LEFT);
  2062.     (void) (*t->text_angle)(0);
  2063.     /* test tic size */
  2064.     (*t->move)(xmax/2+t->h_tic*2,0);
  2065.     (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  2066.     (*t->move)(xmax/2,t->v_tic*2);
  2067.     (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  2068.     (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  2069.     /* test line and point types */
  2070.     x = xmax - t->h_char*4 - t->h_tic*4;
  2071.     y = ymax - t->v_char;
  2072.     for ( i = -2; y > t->v_char; i++ ) {
  2073.         (*t->linetype)(i);
  2074.         /*    (void) sprintf(label,"%d",i);  Jorgen Lippert
  2075.         lippert@risoe.dk */
  2076.         (void) sprintf(label,"%d",i+1);
  2077.         if ((*t->justify_text)(RIGHT))
  2078.             (*t->put_text)(x,y,label);
  2079.         else
  2080.             (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  2081.         (*t->move)(x+t->h_char,y);
  2082.         (*t->vector)(x+t->h_char*4,y);
  2083.         if ( i >= -1 )
  2084.             (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  2085.         y -= t->v_char;
  2086.     }
  2087.     /* test some arrows */
  2088.     (*t->linetype)(0);
  2089.     x = xmax/4;
  2090.     y = ymax/4;
  2091.     xl = t->h_tic*5;
  2092.     yl = t->v_tic*5;
  2093.     (*t->arrow)(x,y,x+xl,y,TRUE);
  2094.     (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  2095.     (*t->arrow)(x,y,x,y+yl,TRUE);
  2096.     (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  2097.     (*t->arrow)(x,y,x-xl,y,TRUE);
  2098.     (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  2099.     (*t->arrow)(x,y,x,y-yl,TRUE);
  2100.     (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  2101.     /* and back into text mode */
  2102.     (*t->text)();
  2103. }
  2104.  
  2105.  
  2106. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  2107. /* output for some terminal types must be binary to stop non Unix computers
  2108.    changing \n to \r\n. 
  2109.    If the output is not STDOUT, the following code reopens outfile 
  2110.    with binary mode. */
  2111. void
  2112. reopen_binary()
  2113. {
  2114. char filename[MAX_ID_LEN+1];
  2115.  
  2116.     if (outfile!=stdout) {
  2117.         (void) fclose(outfile);
  2118.         (void) strcpy(filename,outstr+1);    /* remove quotes */
  2119.         filename[strlen(filename)-1] = '\0';
  2120. #ifdef _Windows
  2121.         if ( !stricmp(outstr,"'PRN'") )
  2122.             (void) strcpy(filename,win_prntmp);    /* use temp file for windows */
  2123. #endif
  2124.         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  2125.             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2126.                 os_error("cannot reopen file with binary type; output unknown",
  2127.                     NO_CARET);
  2128.             } 
  2129.             else {
  2130.     os_error("cannot reopen file with binary type; output reset to ascii", 
  2131.                     NO_CARET);
  2132.             }
  2133.         }
  2134. #if defined(__TURBOC__) && defined(MSDOS)
  2135. #ifndef _Windows
  2136.         if ( !stricmp(outstr,"'PRN'") )
  2137.         {
  2138.         /* Put the printer into binary mode. */
  2139.         union REGS regs;
  2140.             regs.h.ah = 0x44;    /* ioctl */
  2141.             regs.h.al = 0;        /* get device info */
  2142.             regs.x.bx = fileno(outfile);
  2143.             intdos(®s, ®s);
  2144.             regs.h.dl |= 0x20;    /* binary (no ^Z intervention) */
  2145.             regs.h.dh = 0;
  2146.             regs.h.ah = 0x44;    /* ioctl */
  2147.             regs.h.al = 1;        /* set device info */
  2148.             intdos(®s, ®s);
  2149.         }
  2150. #endif
  2151. #endif
  2152.     }
  2153. }
  2154. #endif
  2155.  
  2156. #ifdef vms
  2157. /* these are needed to modify terminal characteristics */
  2158. #include <descrip.h>
  2159. #include <iodef.h>
  2160. #include <ttdef.h>
  2161. #include <tt2def.h>
  2162. #include <dcdef.h>
  2163. #include <ssdef.h>
  2164. #include <stat.h>
  2165. #include <fab.h>
  2166. static unsigned short   chan;
  2167. static int  old_char_buf[3], cur_char_buf[3];
  2168. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  2169.  
  2170. char *vms_init()
  2171. /*
  2172.  * Determine if we have a regis terminal
  2173.  * and save terminal characteristics
  2174. */
  2175. {
  2176.    /* Save terminal characteristics in old_char_buf and
  2177.    initialise cur_char_buf to current settings. */
  2178.    int i;
  2179.    sys$assign(&sysoutput_desc,&chan,0,0);
  2180.    sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2181.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2182.    sys$dassgn(chan);
  2183.  
  2184.    /* Test if terminal is regis */
  2185.    if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  2186.    return(NULL);
  2187. }
  2188.  
  2189. void
  2190. vms_reset()
  2191. /* set terminal to original state */
  2192. {
  2193.    int i;
  2194.    sys$assign(&sysoutput_desc,&chan,0,0);
  2195.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2196.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2197.    sys$dassgn(chan);
  2198. }
  2199.  
  2200. void
  2201. term_mode_tek()
  2202. /* set terminal mode to tektronix */
  2203. {
  2204.    long status;
  2205.    if (outfile != stdout) return; /* don't modify if not stdout */
  2206.    sys$assign(&sysoutput_desc,&chan,0,0);
  2207.    cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  2208.    cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  2209.  
  2210.    cur_char_buf[1] &= ~TT$M_CRFILL;
  2211.    cur_char_buf[1] &= ~TT$M_ESCAPE;
  2212.    cur_char_buf[1] &= ~TT$M_HALFDUP;
  2213.    cur_char_buf[1] &= ~TT$M_LFFILL;
  2214.    cur_char_buf[1] &= ~TT$M_MECHFORM;
  2215.    cur_char_buf[1] &= ~TT$M_NOBRDCST;
  2216.    cur_char_buf[1] &= ~TT$M_NOECHO;
  2217.    cur_char_buf[1] &= ~TT$M_READSYNC;
  2218.    cur_char_buf[1] &= ~TT$M_REMOTE;
  2219.    cur_char_buf[1] |= TT$M_LOWER;
  2220.    cur_char_buf[1] |= TT$M_TTSYNC;
  2221.    cur_char_buf[1] |= TT$M_WRAP;
  2222.    cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  2223.    cur_char_buf[1] &= ~TT$M_MECHTAB;
  2224.    cur_char_buf[1] &= ~TT$M_SCOPE;
  2225.    cur_char_buf[1] |= TT$M_HOSTSYNC;
  2226.  
  2227.    cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  2228.    cur_char_buf[2] &= ~TT2$M_BLOCK;
  2229.    cur_char_buf[2] &= ~TT2$M_DECCRT3;
  2230.    cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  2231.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2232.    cur_char_buf[2] &= ~TT2$M_REGIS;
  2233.    cur_char_buf[2] &= ~TT2$M_SIXEL;
  2234.    cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  2235.    cur_char_buf[2] |= TT2$M_EDITING;
  2236.    cur_char_buf[2] |= TT2$M_INSERT;
  2237.    cur_char_buf[2] |= TT2$M_PRINTER;
  2238.    cur_char_buf[2] &= ~TT2$M_ANSICRT;
  2239.    cur_char_buf[2] &= ~TT2$M_AVO;
  2240.    cur_char_buf[2] &= ~TT2$M_DECCRT;
  2241.    cur_char_buf[2] &= ~TT2$M_DECCRT2;
  2242.    cur_char_buf[2] &= ~TT2$M_DRCS;
  2243.    cur_char_buf[2] &= ~TT2$M_EDIT;
  2244.    cur_char_buf[2] |= TT2$M_FALLBACK;
  2245.  
  2246.    status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2247.    if (status == SS$_BADPARAM) {
  2248.       /* terminal fallback utility not installed on system */
  2249.       cur_char_buf[2] &= ~TT2$M_FALLBACK;
  2250.       sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2251.    }
  2252.    else {
  2253.       if (status != SS$_NORMAL)
  2254.          lib$signal(status,0,0);
  2255.    }
  2256.    sys$dassgn(chan);
  2257. }
  2258.  
  2259. void
  2260. term_mode_native()
  2261. /* set terminal mode back to native */
  2262. {
  2263.    int i;
  2264.    if (outfile != stdout) return; /* don't modify if not stdout */
  2265.    sys$assign(&sysoutput_desc,&chan,0,0);
  2266.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2267.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2268.    sys$dassgn(chan);
  2269. }
  2270.  
  2271. void
  2272. term_pasthru()
  2273. /* set terminal mode pasthru */
  2274. {
  2275.    if (outfile != stdout) return; /* don't modify if not stdout */
  2276.    sys$assign(&sysoutput_desc,&chan,0,0);
  2277.    cur_char_buf[2] |= TT2$M_PASTHRU;
  2278.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2279.    sys$dassgn(chan);
  2280. }
  2281.  
  2282. void
  2283. term_nopasthru()
  2284. /* set terminal mode nopasthru */
  2285. {
  2286.    if (outfile != stdout) return; /* don't modify if not stdout */
  2287.    sys$assign(&sysoutput_desc,&chan,0,0);
  2288.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2289.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2290.    sys$dassgn(chan);
  2291. }
  2292.  
  2293. void
  2294. reopen_binary()
  2295. /* close the file outfile outfile and reopen it with binary type
  2296.    if not already done or outfile == stdout */
  2297. {
  2298.    stat_t stat_buf;
  2299.    char filename[MAX_ID_LEN+1];
  2300.    if (outfile != stdout) { /* don't modify if not stdout */
  2301.       if (!fstat(fileno(outfile),&stat_buf)) {
  2302.          if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  2303.             /* modify only if not already done */
  2304.             (void) fclose(outfile);
  2305.             (void) strcpy(filename,outstr+1);   /* remove quotes */
  2306.             filename[strlen(filename)-1] = '\0';
  2307.             (void) delete(filename);
  2308.             if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  2309.                 == (FILE *)NULL ) {
  2310.                if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2311.                  os_error("cannot reopen file with binary type; output unknown",
  2312.                            NO_CARET);
  2313.                }
  2314.                else {
  2315.           os_error("cannot reopen file with binary type; output reset to ascii",
  2316.                            NO_CARET);
  2317.                }
  2318.             }
  2319.          }
  2320.       }
  2321.       else{
  2322.          os_error("cannot reopen file with binary type; output remains ascii",
  2323.                   NO_CARET);
  2324.       }
  2325.    }
  2326. }
  2327.  
  2328. void
  2329. fflush_binary()
  2330. {
  2331.    typedef short int INT16;     /* signed 16-bit integers */
  2332.    register INT16 k;            /* loop index */
  2333.    if (outfile != stdout) {
  2334.        /* Stupid VMS fflush() raises error and loses last data block
  2335.           unless it is full for a fixed-length record binary file.
  2336.           Pad it here with NULL characters. */
  2337.        for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  2338.           putc('\0',outfile);
  2339.        fflush(outfile);
  2340.    }
  2341. }
  2342. #endif
  2343.